<html>
<head>
<title>Tham gia</title>
<link href="<s:url value='/styles/popupLogin.css'/>" rel="stylesheet"
	media="screen" />

<link href="<s:url value='js/validation/validationEngine.jquery.css'/>"
	rel="stylesheet" media="screen" />
<script type="text/javascript" src="<s:url value='/js/popuplogin.js'/>"></script>

<script type="text/javascript"
	src="<s:url value='js/validation/jquery.validationEngine-vi.js'/>"></script>
<script type="text/javascript"
	src="<s:url value='js/validation/jquery.validationEngine.js'/>"></script>
<script>
	jQuery(document).ready(function() {
		// binds form submission and fields to the validation engine
		//jQuery("#formSignin").validationEngine();

		$("#btnDoSignin").click(function() {
			//$("#btnDoSignin").attr("disabled", "disabled");
			jQuery("#formSignin").validationEngine('validate');

		}),
		jQuery("#formSignin").validationEngine("attach", {
// 			onFailure : function() {
// 				$("#btnDoSignin").removeAttr("disabled");
// 			},
// 			onSuccess : function() {
// 				$("#btnDoSignin").attr("disabled", "disabled");
// 				alert('onSuccess');
// 				//doSignin();
// 			},
			onValidationComplete: function(form, status){
	            if (status == false){
	                
	            }
	            else {
	            	doSignin();
	            }
			},
			ajaxFormValidation: true,
			// Auto-hide prompt
			autoHidePrompt : true,
			// Delay before auto-hide
			autoHideDelay : 2000,
			// Fade out duration while hiding the validations
			fadeDuration : 0.3,
			focusFirstField : false
		});
// 		jQuery("#formSignin").validationEngine('attach', {
// // 			onValidationComplete : function(form, status) {
// // 		                if (status == true) {  
// // 		                	$("#btnDoSignin").attr("disabled", "disabled");
// // 		    				//doSignin(); 
// // 		                }else {
// // 		                	$("#btnDoSignin").removeAttr("disabled");
// // 		                        }
				
// // 			},
// 			onSuccess : function() {
// 				$("#btnDoSignin").attr("disabled", "disabled");
// 				alert('onSuccess');
// 				//doSignin();
// 			},

// 			// Auto-hide prompt
// 			autoHidePrompt : true,
// 			// Delay before auto-hide
// 			autoHideDelay : 2000,
// 			// Fade out duration while hiding the validations
// 			fadeDuration : 0.3,
// 			focusFirstField : false
// 		});
	});
</script>
</head>
<body>

	<div id="login">
		<h1>Đăng nhập</h1>
		<form action="index" class="formLogin" id="formLogin">
			<div>
				<input type="text" name="loginEmail" id="loginEmail" placeholder="Địa chỉ email">
			</div>
			<div>
				<input type="password" name="loginPassword" id="loginPassword" placeholder="Mật khẩu">
			</div>
			<div class="btnSubmit">
				<button type="button" class="btnLogin" onclick="doLogin();">Đăng nhập</button>
				<a href="#" id="" onclick="">Quên mật khẩu?</a>
			</div>
		</form>
		<p>- hoặc -</p>
		<div id="changeToText">
			<button type="button" class="btnLogin longbtn" id="showFormSignin">Tạo
				tài khoản</button>
		</div>
		<form action="#" class="formSignin" id="formSignin" name="formSignin">
			<div>
				<input type="text" name="signinEmail" id="signinEmail"
					placeholder="Địa chỉ email"
					class="validate[required,custom[email]] ">
			</div>
			<div>
				<input type="password" name="signinPassword" id="signinPassword"
					placeholder="Mật khẩu"
					class="validate[required,minSize[6],maxSize[18]]">
			</div>
			<div>
				<input type="password" name="signinRetypePassword"
					id="signinRetypePassword" placeholder="Gõ lại mật khẩu"
					class="validate[required] equals[signinPassword]">
			</div>
			<div>
				<input type="text" name="signinName" id="signinName"
					placeholder="Họ tên" class="validate[required,maxSize[50]]">
			</div>
			<button id="btnDoSignin" class="longbtn">Tham gia</button>
		</form>
	</div>
</body>
</html>